﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace Dapper_Core.Web
{
    public class Program
    {
        public static void Main(string[] args)
        { 
            #region Main()什么时候执行，第一个用户访问时才执行，IIS重启不会执行，IIS停止->启动不会执行
            //string path = @"D:\Log";
            //if (!Directory.Exists(path))
            //{
            //    Directory.CreateDirectory(path);
            //}
            //path = Path.Combine(path, "TestCoreMain" + DateTime.Now.ToString("yyyyMMddHH")) + ".txt";
            //StreamWriter streamWriter = new StreamWriter(path, true);
            //streamWriter.WriteLine("执行了Main()方法" + DateTime.Now);
            //streamWriter.Close();
            //streamWriter.Dispose();
            #endregion

            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>();
    }
}
